/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2012
 */

package com.tech15.task.dao;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import com.tech15.task.model.*;
import com.tech15.task.dao.*;
import com.tech15.task.service.*;
import com.tech15.task.vo.query.*;

/**
 * @author 胡作正 email:zuozhenghu@sina.com
 * @version 1.0
 * @since 1.0
 */


import static cn.org.rapid_framework.util.ObjectUtils.*;
import org.springframework.stereotype.Repository;

@Repository
public class TaskReturnProcessDao extends BaseHibernateDao<TaskReturnProcess,Long>{

	public Class getEntityClass() {
		return TaskReturnProcess.class;
	}
	
	public Page findByPageRequest(PageRequest<Map> pageRequest) {
		//XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
		// [column]为字符串拼接, {column}为使用占位符. 以下为图方便采用sql拼接,适用性能要求不高的应用,使用占位符方式可以优化性能. 
		// [column] 为PageRequest.getFilters()中的key
		String sql = "select t from TaskReturnProcess t where 1=1 "
				+ "/~ and t.userid = '[userid]' ~/"
				+ "/~ and t.zt = '[zt]' ~/"
				+ "/~ and t.fssj = '[fssj]' ~/"
				+ "/~ and t.clsj = '[clsj]' ~/"
				+ "/~ and t.cljg = '[cljg]' ~/"
				+ "/~ and t.trid = '[trid]' ~/"
				+ "/~ order by [sortColumns] ~/";
		
        /*StringBuilder sql2 = new StringBuilder("select t from TaskReturnProcess t where 1=1 ");
        if(isNotEmpty(query.getId())) {
            sql2.append(" and  t.id = :id ");
        }
        if(isNotEmpty(query.getUserid())) {
            sql2.append(" and  t.userid = :userid ");
        }
        if(isNotEmpty(query.getZt())) {
            sql2.append(" and  t.zt = :zt ");
        }
        if(isNotEmpty(query.getFssjBegin())) {
            sql2.append(" and  t.fssj >= :fssjBegin ");
        }
        if(isNotEmpty(query.getFssjEnd())) {
            sql2.append(" and  t.fssj <= :fssjEnd ");
        }
        if(isNotEmpty(query.getClsjBegin())) {
            sql2.append(" and  t.clsj >= :clsjBegin ");
        }
        if(isNotEmpty(query.getClsjEnd())) {
            sql2.append(" and  t.clsj <= :clsjEnd ");
        }
        if(isNotEmpty(query.getCljg())) {
            sql2.append(" and  t.cljg = :cljg ");
        }
        if(isNotEmpty(query.getTrid())) {
            sql2.append(" and  t.trid = :trid ");
        }
        if(isNotEmpty(query.getSortColumns())) {
            sql2.append(" order by :sortColumns ");
        }*/
		return pageQuery(sql,pageRequest);
	}
	

}
